UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yzck7O30IP8eTIguNo0HSXIJcpGGeanG7c4TAs9mulU=' 
WHERE 
  key_id = '8b5d6ab3b86fba2cf3e0d16ea3fda3ca95e0127f8851fe790ecff319256ed001' 
  AND (
    token = 'yzck7O30IP8eTIguNo0HSXIJcpGGeanG7c4TAs9mulU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016