UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0xGYRmSyeI6psLuVBGDNdWuAW1R6nAh6dlA827+YY/o=' 
WHERE 
  key_id = 'fc2398d87c6b0080aaa6afa7e2d00f894bc6cb0b1df7b366c5ca26a1cb4c763f' 
  AND (
    token = '0xGYRmSyeI6psLuVBGDNdWuAW1R6nAh6dlA827+YY/o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034