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

Query time 0.00029