UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aAbjmNuRHHT6dRhHbQ2zN/vo1ml76H3ORuQvN3Sv2J8=' 
WHERE 
  key_id = 'f1661004097c90d01c3e01822727dc5c4927a9d128fe3de43903896f91961575' 
  AND (
    token = 'aAbjmNuRHHT6dRhHbQ2zN/vo1ml76H3ORuQvN3Sv2J8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034