UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aZjS+qg5d9f3GydkPSZae0B/JgB0RMBNXfkXJfTHCcQ=' 
WHERE 
  key_id = '4f0794b573f48d9f059f4c8bc978d02c45aeb80404d806bad03f2f89d213933a' 
  AND (
    token = 'aZjS+qg5d9f3GydkPSZae0B/JgB0RMBNXfkXJfTHCcQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022