UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PLBOcjIMxH0+QBqr3DI6c/cXmWlBantwLu1r7jYKYVw=' 
WHERE 
  key_id = '7ac47d9d32cb072aae0e819e1ef64630aa2525e470ca677353f6adbbea054161' 
  AND (
    token = 'PLBOcjIMxH0+QBqr3DI6c/cXmWlBantwLu1r7jYKYVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034