UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iBOZDC6KzyfSCOW0ka0dJVhQBKbE040SCJA7imY6DDg=' 
WHERE 
  key_id = '7cd836eddb08cd510d7d2a903fd7ca351658df4fe2f5c45923decffde89235b2' 
  AND (
    token = 'iBOZDC6KzyfSCOW0ka0dJVhQBKbE040SCJA7imY6DDg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031