UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l7oFH5nEuERPk+UT5wsZDZy1YAgWkRO0rah+GAaEw6s=' 
WHERE 
  key_id = 'f39a3996bfc976865b9f99775991aef281a2413a0e50e20a6c70c1951c6232e3' 
  AND (
    token = 'l7oFH5nEuERPk+UT5wsZDZy1YAgWkRO0rah+GAaEw6s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019