UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1L+8t2wPjeW5XA/HcDD4JFl9ngH+BLEmL46SPju7RZ0=' 
WHERE 
  key_id = 'a535bc64e50e947a666b5d5aaae996786dfb454154f8488cee45244cf80444ce' 
  AND (
    token = '1L+8t2wPjeW5XA/HcDD4JFl9ngH+BLEmL46SPju7RZ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042