UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SGwdNFD2cC1QV0zM0siN5oQpusanYOPLOD8YS6dnIp0=' 
WHERE 
  key_id = '1b080723c9dc5facffb3d6d765fa06cbbaa5fe519d3c5f53f13ff38e261d8f5f' 
  AND (
    token = 'SGwdNFD2cC1QV0zM0siN5oQpusanYOPLOD8YS6dnIp0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052