UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R0PyFJ4kL3LIbl2g6tMpDhEBZ9rYCcfYk55cOYLRhK8=' 
WHERE 
  key_id = '4a30c28e1fe6c1d26627ff6f0c9c202af63790ac81fcc25fbdefe88832383b76' 
  AND (
    token = 'R0PyFJ4kL3LIbl2g6tMpDhEBZ9rYCcfYk55cOYLRhK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052