UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D7vNYoXkLxR81KB295RKrBqZg49rTr3iMWyRTz0RKpE=' 
WHERE 
  key_id = 'afe689b4282d451844f4fcb8d2e3b98db4c519e26deabbbea6a1c260a802bd41' 
  AND (
    token = 'D7vNYoXkLxR81KB295RKrBqZg49rTr3iMWyRTz0RKpE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026