UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OMwxlLlpXlfXDJfF5Bkb7d8aC2HtH3+ixNq7XoA+Jfc=' 
WHERE 
  key_id = '7dc8f48e21a311ee0900b4d059352303c73243a15f76fe6204f672ddc39f013c' 
  AND (
    token = 'OMwxlLlpXlfXDJfF5Bkb7d8aC2HtH3+ixNq7XoA+Jfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034