UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j+xqFaULhNYh9mr9Qabo+e+bgohjOm/icppX23zi+DA=' 
WHERE 
  key_id = 'a22421979fea98f7796e6022d85ee08dd2f8cc3d36bcbc2e3dc535ba6823edfc' 
  AND (
    token = 'j+xqFaULhNYh9mr9Qabo+e+bgohjOm/icppX23zi+DA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040