UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9ruSmRsgEbz0dITt5A6Si63k/tbuX2+mSn34bHTcDIU=' 
WHERE 
  key_id = '3e3b213c9f32a9d507e23b8ae7d3c546f8203b1fdf7114214480652550603d4d' 
  AND (
    token = '9ruSmRsgEbz0dITt5A6Si63k/tbuX2+mSn34bHTcDIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039