UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q5fSqGDYgLoK0ersIc/n5qoVnPk5pfwiipDEXHK/SKk=' 
WHERE 
  key_id = '8fc5670760141b2f7c9703a90d6b6234659341f0711faf8a0230df52c5fb559e' 
  AND (
    token = 'q5fSqGDYgLoK0ersIc/n5qoVnPk5pfwiipDEXHK/SKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044