UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Maq0FR4SzNnMzd9JmxxTAfxyBrJaw1giBx7+M4W25hk=' 
WHERE 
  key_id = '6afb2bfc748d6dcf19aca036b50bfd9f75facb7879275cf11c7dab89009a2dc1' 
  AND (
    token = 'Maq0FR4SzNnMzd9JmxxTAfxyBrJaw1giBx7+M4W25hk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031