UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UBwrIk30y+V4/SlUE002Fpt+YZ/Gx6LpXIghnfmbXfM=' 
WHERE 
  key_id = '96237d97d67eaeda27e4416f9bdcef521a6281cded3a26f71c52ee71175c4cec' 
  AND (
    token = 'UBwrIk30y+V4/SlUE002Fpt+YZ/Gx6LpXIghnfmbXfM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028