UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ap372THHWWrIatGpWV/1RwjUamsA/Fz0FZL3FNrivkM=' 
WHERE 
  key_id = '87dfc72ae289d83d485f8e48cd333e612752d1e83db352c7bcc25e36743c5c03' 
  AND (
    token = 'ap372THHWWrIatGpWV/1RwjUamsA/Fz0FZL3FNrivkM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044