UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M1djf9bTp6zAddXltxKA5NxQ+ciq7yRxV+BT/K57cl8=' 
WHERE 
  key_id = '643eda707d882835bbd348035938e53337725e5dadc1f3350aa13ef91a339888' 
  AND (
    token = 'M1djf9bTp6zAddXltxKA5NxQ+ciq7yRxV+BT/K57cl8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032