UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qQJ1Q7kkSvbyH6/3rQXnZ4IY2O/PzbttBqD4NgDnhC8=' 
WHERE 
  key_id = 'ba0c74ffc57b8ea1eb1efc0b286b3da349290002a234729a09816925eb3fd312' 
  AND (
    token = 'qQJ1Q7kkSvbyH6/3rQXnZ4IY2O/PzbttBqD4NgDnhC8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031