UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LxYZPBrXmBkNu9Xx2cYJYVbSq2GPdPR8xnQLsU5Bmt0=' 
WHERE 
  key_id = '4184b1fe71116bf4b9348cae1af1012c968905c17ee92940c1ce55d9d35f5c9a' 
  AND (
    token = 'LxYZPBrXmBkNu9Xx2cYJYVbSq2GPdPR8xnQLsU5Bmt0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050