UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V+NzpV0iIM1Zqsfn70st/W5u+WZbrgj7ueUgYq7WiOQ=' 
WHERE 
  key_id = '576cf5eb700878aff779e2a70e4b83c281ef91169053f672d622699082695563' 
  AND (
    token = 'V+NzpV0iIM1Zqsfn70st/W5u+WZbrgj7ueUgYq7WiOQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023