UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D+6bSLT3gx/oPzF/HCKjyfwivGFodRBV1L67QyztvPU=' 
WHERE 
  key_id = 'b433e74440f6e9feefea0dbfc48802d78cb5c5833fb7d80bfee72688b243e31a' 
  AND (
    token = 'D+6bSLT3gx/oPzF/HCKjyfwivGFodRBV1L67QyztvPU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035