UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZLYo0ebrVaVWs7aHAVvS7R7lqP6zlXFStezYXHC09CM=' 
WHERE 
  key_id = 'd6c95a962cbc003de5a6fb3d195dc974c14048a26a3c5595eae89b0d001da212' 
  AND (
    token = 'ZLYo0ebrVaVWs7aHAVvS7R7lqP6zlXFStezYXHC09CM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026