UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '57mvMMhEhfhEb5F2mmBLZukKHNeWhVHgirNB+zsY2ZY=' 
WHERE 
  key_id = 'e0582a527284809f782c800d5dbf137c48445a1da649c2775a8e0385317cfdc5' 
  AND (
    token = '57mvMMhEhfhEb5F2mmBLZukKHNeWhVHgirNB+zsY2ZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020