UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VjuLt14mZrCAzvpyF6lNYEWV3XEOUo5Q1rr1GTQcRTY=' 
WHERE 
  key_id = 'd9d58da3c9b9e344a0fba35e767b10c6c6a5f0b906211850112cb3047e38bae3' 
  AND (
    token = 'VjuLt14mZrCAzvpyF6lNYEWV3XEOUo5Q1rr1GTQcRTY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046