UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6UnP86bD6P93aONzg5OsYe7/YPv2AIgNKzyzny2HY6U=' 
WHERE 
  key_id = '6b680441aa021583a00e204c29371324b46f7417e13753d5392bb2d4639a0bf8' 
  AND (
    token = '6UnP86bD6P93aONzg5OsYe7/YPv2AIgNKzyzny2HY6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040