UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M7Ouop3AhSqPLbewfDE7fdmmr30tscA72vHn+GB2ev8=' 
WHERE 
  key_id = '3dc3430ae99a5f6253fc20b6babb7161b0e4d10bd1355b2f9bd85546c1f8fc40' 
  AND (
    token = 'M7Ouop3AhSqPLbewfDE7fdmmr30tscA72vHn+GB2ev8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019