UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5omR8RdGesipsV+hwgKR/1yAMN34zL7L1Whtu8A6iNw=' 
WHERE 
  key_id = 'dedbc434258236570d2144dde62d854c797b035acae6190995dbf0f705238f42' 
  AND (
    token = '5omR8RdGesipsV+hwgKR/1yAMN34zL7L1Whtu8A6iNw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028