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

Query time 0.00027