UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zgQC/WxzkAXIACkzj2amRzW/xwOwjsY6vDEY4GrmWVE=' 
WHERE 
  key_id = '427ade1c566f3fdcc3a90908bea7ec3e5772057d157abce200c4bde236103bb2' 
  AND (
    token = 'zgQC/WxzkAXIACkzj2amRzW/xwOwjsY6vDEY4GrmWVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041