UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fhtTK2pN3RqvoFjZiMW0w+lTYukQYEh7IQXJI+rji1A=' 
WHERE 
  key_id = '58a2247ef451b405de15a8f97d60381f1a89515be71bd187840944a348a0b219' 
  AND (
    token = 'fhtTK2pN3RqvoFjZiMW0w+lTYukQYEh7IQXJI+rji1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037