UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NNEZUofU7IW3CNXJGCZ4NERd0xKnXEvflQ+wPCF2UzA=' 
WHERE 
  key_id = 'd7dacf241050d470838a5d87412233d1352cbe1f28df558618e198a351707430' 
  AND (
    token = 'NNEZUofU7IW3CNXJGCZ4NERd0xKnXEvflQ+wPCF2UzA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033