UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eZsUtocaMhUVtPcThURUzaQ0kujH8dwatPz0Zhz+9IU=' 
WHERE 
  key_id = 'f42c7bd429ec915cec63e91084d6dbfcf28aebc9d5762e02e52bbd3505fae2cb' 
  AND (
    token = 'eZsUtocaMhUVtPcThURUzaQ0kujH8dwatPz0Zhz+9IU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032